<template>
	<view class="user clearfix ">
		<view class="bg-user"></view>
		<!-- 头部信息 -->
		<view class="top-user flex flex-direction por">
			<view class="flex align-center justify-end px15" style="background-color: #df2f22;">
				<image src="/static/my/set.png" @click="pushPage('/pages/user/shezhi')" class="set" mode=""></image>
			</view>
			<view class="flex al-strar justify-between px15"  style="background-color: #df2f22;padding: 30rpx 0;">
				<view class="flex align-center h60">
					<image :src="userInfo.headImg" class="block60 round" mode=""></image>
					<view class="ml15 flex flex-direction hp100 justify-start">
						<text class="f12 text-white mt10">ID：{{userInfo.uid}}</text>
						<text class="f12 text-white mt10">手机号：{{userInfo.tel}}</text>
					</view>
				</view>
				<view class="flex al-strar f12 text-white mt10">
					<text>当前等级：</text>
					<text class="text-yellow">{{userInfo.vipName}}</text>
				</view>
			</view>
			<view class="flex align-center justify-between" style="background-image: url('/h5/static/my/bg.png');padding: 30rpx 0;">
				<view class="wp25 flex flex-direction align-center">
					<text class="f16">{{userInfo.sumAllDay}}</text>
					<text class="mt10 f12">总收益</text>
				</view>
				<view class="wp25 flex flex-direction align-center">
					<text class="f16">{{userInfo.sunNowDay}}</text>
					<text class="mt10 f12">今日收入</text>
				</view>
				<view class="wp25 flex flex-direction align-center">
					<text class="f16">{{zichan.ydNum}}</text>
					<text class="mt10 f12">邦豆</text>
				</view>
				<view class="wp25 flex flex-direction align-center" @click="pushPage('/pages/wallet/historey?type=0')">
					<text class="f16">{{userInfo.yue}}</text>
					<text class="mt10 f12">余额</text>
				</view>
			</view>
			<!-- <view class="order-line mt15"></view> -->
			<view class="flex align-center justify-between mt20">
				<view class="wp25 flex flex-direction align-center" @click="saoyisao">
					<image src="/static/my/pls0.png" class="block25" mode=""></image>
					<text class="mt10 f12">扫一扫</text>
				</view>
				<view class="wp25 flex flex-direction align-center" @click="pushPage('/pages/usertransfer/collection')">
					<image src="/static/my/pls1.png" class="block25" mode=""></image>
					<text class="mt10 f12">收款</text>
				</view>
				<view class="wp25 flex flex-direction align-center" @click="pushPage('/pages/usertransfer/transfer')">
					<image src="/static/my/pls2.png" class="block25" mode=""></image>
					<text class="mt10 f12">付钱</text>
				</view>
				<view class="wp25 flex flex-direction align-center" @click="pushPage('/pages/wallet/historey?type=4')">
					<image src="/static/my/pls3.png" class="block25" mode=""></image>
					<text class="mt10 f12">种子</text>
				</view>
			</view>
		</view>
		<scroll-view class="scroll-view user user-scroll-view" scroll-y>
			<!-- 订单 -->
			<view class="mx15 bg-white mt15 py15">
				<view class="flex align-center justify-between px15">
					<text class="f18">我的订单</text>
					<view class="f12 text-info" @click="pushall"><text>查看全部订单</text><text class="f12 cuIcon-right"></text></view>
				</view>
				<view class="mt15 order-lines"></view>
				<view class="flex align-center justify-between mt20">
					<view class="wp25 flex flex-direction align-center" @click="pushorder(1)">
						<image src="/static/my/order0.png" class="block25" mode=""></image>
						<text class="mt10 f12">待付款</text>
					</view>
					<view class="wp25 flex flex-direction align-center" @click="pushorder(2)">
						<image src="/static/my/order1.png" class="block25" mode=""></image>
						<text class="mt10 f12">待发货</text>
					</view>
					<view class="wp25 flex flex-direction align-center" @click="pushorder(3)">
						<image src="/static/my/order2.png" class="block25" mode=""></image>
						<text class="mt10 f12">待收货</text>
					</view>
					<view class="wp25 flex flex-direction align-center" @click="pushorder(4)">
						<image src="/static/my/order3.png" class="block25" mode=""></image>
						<text class="mt10 f12">已完成</text>
					</view>
				</view>
			</view>
			<!-- 店主 -->
			<view class="mx15 discenter mt15" @click="pushPage('/pages/class/viplist')">
				<image src="/static/my/share.png" class="wp100 h80" mode=""></image>
			</view>
			<!-- 常用功能 --> 
			<view class="mx15 bg-white mt15 py15">
				<view class="flex align-center px15">
					<text class="f18">常用功能</text>
				</view>
				<view class="mt15 order-lines"></view>
				<view class="flex align-center justify-between flex-wrap">
					<view class="wp25 flex flex-direction align-center mt20" @click="pushlist(index)" v-for="(item,index) in list" :key="index">
						<image :src="'/static/my/list'+index+'.png'" class="block55"></image>
						<text class="f12" v-if="index!=2">{{item}}</text>
						<text v-if="isdianpu!=1&&index==2" class="f12">我要开店</text>
						<text v-if="isdianpu==1&&index==2" class="f12">我的店铺</text>
					</view>
				</view>
			</view>
			<!-- 生活服务 -->
			<view class="mx15 bg-white mt15 py15">
				<view class="flex align-center px15">
					<text class="f18">生活服务</text>
				</view>
				<view class="mt15 order-lines"></view>
				<view class="flex align-center  flex-wrap">
					<view class="wp25 flex flex-direction align-center mt20" @click="pushPage('')" v-for="(item,index) in life" :key="index">
						<image :src="'/static/my/nav'+index+'.png'" :class="'nav-pic'+index"></image>
						<text class=" f12 mt10">{{item}}</text>
					</view>
				</view>
			</view>
			<!-- 第三方服务 -->
			<view class="mx15 bg-white mt15 py15">
				<view class="flex align-center px15">
					<text class="f18">第三方服务</text>
				</view>
				<view class="mt15 order-lines"></view>
				<view class="flex align-center justify-between flex-wrap">
					<view class="wp25 flex flex-direction align-center mt20" @click="pushPage('')" v-for="(item,index) in dsf" :key="index">
						<image :src="'/static/my/sanfang'+index+'.png'" class="sanfangpic"></image>
						<text class="f12">{{item}}</text>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
	data() {
		return {
			list:['我的资产','我的认证','我要开店','我的地址','我的收藏','我要分享','我的拼团', '购物车'],
			life:['充值中心','生活缴费','加油卡','火车飞机票','还信用卡','余利宝','存金宝'],
			dsf:['游戏','种树','滴滴','视频'],
			isdianpu:0,
			listurl:['/pages/wallet/index','/pages/user/shiming','/pages/user/set','/pages/address/index','/pages/user/shoucangs','/pages/user/share','/pages/order/pintuanorder', '/pages/cart/index'],
			zichan:{},
			systemZc:{},
		}
	},
	onLoad() {},
	onShow() {
		this.getUser()
		this.getData()
	},
	created:function(){
		let isdianpu = uni.getStorageSync('isdianpu')
		this.isdianpu = isdianpu;
	},
	computed: {
		...mapState(['userInfo'])
	},
	
	methods:{ 
		...mapActions(['getUser','logout','setOrder']),
		pushorder(e){
			this.setOrder(e)
			uni.navigateTo({
				url:'/pages/order/index'
			})
		},
		pushall(){
			this.setOrder(0)
			uni.navigateTo({
				url:'/pages/order/index'
			})
		},
		saoyisao(){
			uni.scanCode({
			    success: function (res) {
					console.log(res.result)
			        uni.navigateTo({
			        	url:'/pages/usertransfer/transfers?'+res.result
			        })
			    },
			});
		},
		pushlist(index){
			if(index!=2){
				this.pushPage(this.listurl[index])
			}else{
				if(this.isdianpu!=1){
					this.pushPage('/pages/store/sjieshao')
				}else{
					this.pushPage('/pages/mystore/index')
				}
			}
		},
		async getData() {
			let {
				data: { zichan, systemZc }
			} = await this.$http.post('wallet.index', {}, { tipConfig: { storeBlock: true } })
			this.zichan=zichan
			this.systemZc=systemZc
		}
	}
}
</script>

<style lang="less">
.bg-user{
	// background-color: #df2f22;
	position: fixed;
	top: 0;
	width: 100%;
	height: calc(560rpx + var(--status-bar-height));
}
.top-user{
	width: 100%;
	height: calc(560rpx + var(--status-bar-height));
}
.por{
	position: relative;
	z-index: 1;
}
.order-line{
	width: calc(100% - 120rpx);
	margin-left: 60rpx;
	background-color: #ff8277;
	height: 1rpx;
}
.order-lines{
	width: 100%;
	background-color: #F3F2F2;
	height: 1rpx;
}
.block55{
	width: 110rpx;
	height: 110rpx;
}
.sanfangpic{
	width: 82rpx;
	height: 100rpx;
}
.set{
	margin-top: calc(30rpx + var(--status-bar-height));
	width: 40rpx;
	height: 40rpx;
}
.nav{
	&-pic0{
		width: 55rpx;
		height: 47rpx;
	}
	&-pic1{
		width: 45rpx;
		height: 52rpx;
	}
	&-pic2{
		width: 48rpx;
		height: 51rpx;
	}
	&-pic3{
		width: 42rpx;
		height: 52rpx;
	}
	&-pic4{
		width: 54rpx;
		height: 47rpx;
	}
	&-pic5{
		width: 50rpx;
		height: 50rpx;
	}
	&-pic6{
		width: 51rpx;
		height: 51rpx;
	}
}
.user-scroll-view {
	height: calc(100vh - 560rpx - 100rpx);
}
</style>
